package com.baor.controller;

import com.baor.base.util.R;
import com.baor.domain.MovieVO;
import com.baor.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class MovieController {

    @Autowired
    private MovieService movieService;

    @RequestMapping(value = "/movieList")
    public String movieList(@RequestBody(required = false) Map<String, Object> params) {
        return this.movieService.movieList(params).toJSONString();
    }

    @RequestMapping(value="/movieInfo")
    public MovieVO movieInfo(@RequestParam("movieId") Integer movieID,@Value("${server.port}") int port) {
        int i = 1 / 0;
        System.out.println(port);
        return this.movieService.movieInfo(movieID);
    }
    @RequestMapping(value="/hello")
    public String  hello() {
        return "hello";
    }
}
